package com.jsoft.pds.bs.dao.Impl;

import java.util.List;

import org.hibernate.Query;

import com.jsoft.pds.bs.dao.PediatricsDao;
import com.jsoft.pds.bs.dao.hibernate.AbstractDaoHibernateImpl;
import com.jsoft.pds.eis.bo.Paciente;
import com.jsoft.pds.eis.bo.base.BaseEntity;

public class PediatricsDaoImpl extends AbstractDaoHibernateImpl implements PediatricsDao {

	/** QUERIES */
	private String GET_PERSONA_BY_ID = "getPersonaById";
	
	public <T> BaseEntity save(BaseEntity baseEntity) {
		return super.save(baseEntity);		
	}
	
	public void update(BaseEntity baseEntity){
		super.update(baseEntity);
	}
	
	public void delete(BaseEntity baseEntity){
		super.delete(baseEntity);
	}
	
	public <T> List<T> find(BaseEntity baseEntity) {
		return super.find(baseEntity);
	}
	
	public <T> BaseEntity findById(Class<? extends BaseEntity> clazz, Integer id) {
		return super.findWithLoad(clazz, id);
	}
	
	public <T> List<T> findAll(Class<? extends BaseEntity> clazz) {
		return super.findAll(clazz);
	}
	
	public Paciente findPersonaById(Integer id){
		Query query = super.getQuery(GET_PERSONA_BY_ID);
		query.setInteger("personaId", id);
		return (Paciente) query.uniqueResult();
	}
	
	
}
